home *** CD-ROM | disk | FTP | other *** search
/ NASA Climatology Interdisciplinary Data Collection / NASA Climatology Interdisciplinary Data Collection - Disc 4.iso / software / grads / lib / functions / ofile.gf < prev    next >
Encoding:
Text File  |  1994-02-17  |  557 b   |  32 lines

  1. function ofile(fname)
  2.   'query files'
  3.   'say files = 'result
  4.   i = 0
  5.   while (1)  
  6.     if (subwrd(result,1)='No')       
  7.       ret = 0
  8.       break;
  9.     endif
  10.     rec = sublin(result,i*3+2)
  11.     if (rec='') 
  12.       ret = 0;
  13.       break; 
  14.     endif
  15.     if (subwrd(rec,2)=fname)
  16.       rec = sublin(result,i*3+1)
  17.       ret = subwrd(rec,2)
  18.       break;
  19.     endif
  20.     i = i + 1
  21.   endwhile
  22.   if (ret=0) 
  23.     'open 'fname
  24.     if (rc>0) 
  25.       say "Error opening "fname
  26.       return (0)
  27.     endif
  28.     rec = sublin(result,2)
  29.     ret = subwrd(rec,8)
  30.   endif
  31.  
  32. return(ret)